import pandas as pd
import numpy as np
import pylab
import matplotlib.pyplot as plt
import os
import geopandas as gp
from shapely.geometry import Point


def roma_taxi_gps_display():
    figsize = 100,100
    fig, ax = plt.subplots(figsize=figsize)

    ax.set_aspect('equal')
    cnt = 0
    for i in range(400):
        filename = './cluster/'+str(i)+'.csv'
        print(filename)
        if not os.path.exists(filename):
            print('i')
            continue
        else:
            print(i)
            df = pd.read_csv('~/下载/crowdtrack/cluster/'+str(i)+'.csv', header=None, names=['time', 'lat', 'lon'])
            cnt += len(df)
            gdf = gp.GeoDataFrame(df, geometry=gp.points_from_xy(df.lat,df.lon))
            #gdf.scale(xfact=5, yfact=5)
            gdf.plot(ax=ax, marker='o', color='black', markersize=0.001)

    # plt.savefig('roma.png')
    # print(cnt)
    plt.savefig('roma.eps', format='eps')

def place_display():
    figsize = 100,100
    fig, ax = plt.subplots(figsize=figsize)

    ax.set_aspect('equal')

    df = pd.read_csv('~/下载/crowdtrack/place/1min.csv', header=None, names=['lat', 'lon'])
    gdf = gp.GeoDataFrame(df, geometry=gp.points_from_xy(df.lat,df.lon))
    gdf.plot(ax=ax, marker='.', color='black', markersize=0.001)

    df2 = pd.read_csv('~/下载/crowdtrack/place/1min_100m.csv', header=None, names=['lat', 'lon'])
    gdf2 = gp.GeoDataFrame(df2, geometry=gp.points_from_xy(df2.lat,df2.lon))
    gdf2.plot(ax=ax, marker='v', color='red', markersize=0.001)
    #plt.show()
    plt.savefig('./place/1min_100m.png')


if __name__ == '__main__':
    place_display()

